#include <dbg.h>
#include <gtest/gtest.h>
using namespace std;

class Solution {
public:
    string makeFancyString(string s) {
        string ret;

        int cnt = 0;
        for (int i = 0; i < s.size(); ++i) {
            cnt = (i > 0 && s[i] == s[i - 1]) ? cnt + 1 : 1;
            if (cnt < 3) {
                ret.push_back(s[i]);
            }
        }

        return ret;
    }
};

TEST(TEST1, makeFancyString) {
    Solution s;
    EXPECT_EQ(s.makeFancyString("leeetcode"), "leetcode");
}

TEST(TEST2, makeFancyString) {
    Solution s;
    EXPECT_EQ(s.makeFancyString("aaabaaaa"), "aabaa");
}

TEST(TEST3, makeFancyString) {
    Solution s;
    EXPECT_EQ(s.makeFancyString("aab"), "aab");
}

int main(int argc, char** argv) {
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}